<?php

	function getPipePos($n, $line)
	{
		$pos = 0;
		for ($i = 0; $i < $n; $i++)
		{
			$pos = strpos($line, "|", $pos + 1);
		}
		return $pos;
	}

	function getField($s, $e, $line)
	{
		$start = getPipePos($s, $line) + 1;
		$length = getPipePos($e, $line) - $start;
		return substr($line, $start, $length);
	}

	$statsfilename = "fullplayerstats.data";
	$statsfile = file_get_contents("out/" . $statsfilename);
	$statslines = explode("\n", $statsfile);

	echo "<h3>Missing fields:</h3>";
	$i = 0;
	foreach ($statslines as $line)
	{
		$count = substr_count($line, "|");
		if ($count != 61)
		{
			echo "<br>".getField(5, 6, $line)."\t ".$count;
		}
		$i++;
	}
	echo "<h3>No. of players: ".($i-1)."</h3>";
?>